# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.OSPolicyAssignment do
  @moduledoc """
  OS policy assignment is an API resource that is used to apply a set of OS policies to a dynamically targeted group of Compute Engine VM instances. An OS policy is used to define the desired state configuration for a Compute Engine VM instance through a set of configuration resources that provide capabilities such as installing or removing software packages, or executing a script. For more information about the OS policy resource definitions and examples, see [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).

  ## Attributes

  *   `baseline` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates that this revision has been successfully rolled out in this zone and new VMs will be assigned OS policies from this revision. For a given OS policy assignment, there is only one revision with a value of `true` for this field.
  *   `deleted` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates that this revision deletes the OS policy assignment.
  *   `description` (*type:* `String.t`, *default:* `nil`) - OS policy assignment description. Length of the description is limited to 1024 characters.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - The etag for this OS policy assignment. If this is provided on update, it must match the server's etag.
  *   `instanceFilter` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter.t`, *default:* `nil`) - Required. Filter to select VMs.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Resource name. Format: `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}` This field is ignored when you create an OS policy assignment.
  *   `osPolicies` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicy.t)`, *default:* `nil`) - Required. List of OS policies to be applied to the VMs.
  *   `reconciling` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates that reconciliation is in progress for the revision. This value is `true` when the `rollout_state` is one of: * IN_PROGRESS * CANCELLING
  *   `revisionCreateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp that the revision was created.
  *   `revisionId` (*type:* `String.t`, *default:* `nil`) - Output only. The assignment revision ID A new revision is committed whenever a rollout is triggered for a OS policy assignment
  *   `rollout` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentRollout.t`, *default:* `nil`) - Required. Rollout to deploy the OS policy assignment. A rollout is triggered in the following situations: 1) OSPolicyAssignment is created. 2) OSPolicyAssignment is updated and the update contains changes to one of the following fields: - instance_filter - os_policies 3) OSPolicyAssignment is deleted.
  *   `rolloutState` (*type:* `String.t`, *default:* `nil`) - Output only. OS policy assignment rollout state
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Output only. Server generated unique id for the OS policy assignment resource.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :baseline => boolean() | nil,
          :deleted => boolean() | nil,
          :description => String.t() | nil,
          :etag => String.t() | nil,
          :instanceFilter =>
            GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter.t() | nil,
          :name => String.t() | nil,
          :osPolicies => list(GoogleApi.OSConfig.V1.Model.OSPolicy.t()) | nil,
          :reconciling => boolean() | nil,
          :revisionCreateTime => DateTime.t() | nil,
          :revisionId => String.t() | nil,
          :rollout => GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentRollout.t() | nil,
          :rolloutState => String.t() | nil,
          :uid => String.t() | nil
        }

  field(:baseline)
  field(:deleted)
  field(:description)
  field(:etag)
  field(:instanceFilter, as: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter)
  field(:name)
  field(:osPolicies, as: GoogleApi.OSConfig.V1.Model.OSPolicy, type: :list)
  field(:reconciling)
  field(:revisionCreateTime, as: DateTime)
  field(:revisionId)
  field(:rollout, as: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentRollout)
  field(:rolloutState)
  field(:uid)
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyAssignment do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.OSPolicyAssignment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyAssignment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
